package com.mika.music.service;

import com.mika.music.mapper.CommentMapper;
import com.mika.music.model.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentService {
    @Autowired
    private CommentMapper commentMapper;

    public Integer addComment(Comment comment) {
        return commentMapper.addComment(comment);
    }

    public List<Comment> getComments(Integer id, Integer startIndex, Integer commentsPerPage) {
        return commentMapper.getComments(id, startIndex, commentsPerPage);
    }

    public Integer getCommentCountsByMusicId(Integer id) {
        return commentMapper.getCommentCountsByMusicId(id);
    }

    public Integer deleteCommentByMusicId(Integer id) {
        return commentMapper.deleteCommentByMusicId(id);
    }
}
